<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //创建一个对象 表示学生的信息 （具体信息可以自定义，需求不限）
        var xm = {
            name: "小明",
            age: 18,
            sex: "男",
            height: "178cm",
            hobby: "倒立洗头",
            fn: function () {
                console.log(`大家好我叫${xm.name},今年${xm.age}岁，性别${xm.sex},我的爱好是${xm.hobby}`)
            }
        }
        xm.fn()
    </script>
</body>

</html>